Ext.namespace('cht.add');


cht.add.win1=Ext.extend(Ext.Window,{
	
	layout:'border',
	initComponent : function() {

		this.title="参数配置",
		this.frame=true;
        this.border=true;
        this.width=650;
        this.height=600;
        this.buttonAlign='right';
        this.modal=true;
        var form = this.xForm();
		this.items = form;
        this.buttons=[{id:'before',text:"上一步"},{id:'next',text:"下一步",handler:function(){
        	
        	var form=Ext.getCmp("formadd");
        	form.form.doAction('submit',{  
                url : path+'/Tree/formGet.html',  
                method : 'POST',  
                params:{
                	chthaoshuai:"1111111"
                },
        	    success:function(){
        	    	
        	    },
        	    error:function(){
        	    	
        	    }
                
        	});
                
        }}];

		
        cht.add.win1.superclass.initComponent.call(this);
	},
	beforeDestroy : function() {
		cht.add.win1.superclass.beforeDestroy.apply(this, arguments);

	},
	xForm : function() {
		
		 var store=new Ext.data.Store({
				proxy : new Ext.data.HttpProxy({
					url : path+'/Tree/pp.html'
				}),
				autoLoad:false,
				reader : new Ext.data.JsonReader({
					root : 'items',
					fields : [{name:"id"},{name:"text"}]
				}),
				listeners:{
					"load":function(){
						var data={id:"",text:"-全部-"};
						var record=[new Ext.data.Record(data)];
						store.insert(0,record);
					}
					
				}
			 
			 
			 
		 });
		 
		 store.load();
		
		 var store2=new Ext.data.Store({
				proxy : new Ext.data.HttpProxy({
					url : path+'/Tree/pp2.html'
				}),
				autoLoad:false,
				reader : new Ext.data.JsonReader({
					root : 'items',
					fields : [{name:"id"},{name:"text"}]
				})
			 
			 
			 
		 });
		  
		
		  
		  var combos2=new Ext.form.ComboBox({
			  id:"combos2",
			  fieldLabel:"人员分类",
			  mode : 'local',
		      triggerAction : 'all',
		      editable :false, 
		      displayField : 'text',
		      valueField : 'id',
		      width:120,
		      store:store2
		   
		      
		  });
		
		  
		  var combos1=new Ext.form.ComboBox({
			  id:"combos1",
			  fieldLabel:"功能分类",
			  mode : 'remote',
		      triggerAction : 'all',
		      editable :false, 
		      displayField : 'text',
		      valueField : 'id',
		      width:120,
		      store:store,
		      listeners:{
		    	 
		    	 "select":function(combo,record,index){
		    		 store2.removeAll();
		    		 store2.load({
		    				url : path+'/Tree/pp.html',
		    			params:{
		    				
		    			id:record.get("id")	
		    			} 
		    			 
		    		 });
		    	 }
		    	  
		      }
		      
		  });
		  
		
		  var   addset = new Ext.form.FieldSet({
			 
			   autoHeight : true,
	           border:true,
	           frame:true,
	           labelWidth:60,
	           layout:'form',
	           items:[{layout:"column",items:[ {
	        	   layout:"column",columnWidth:.6,items:[{layout:"form",columnWidth:.7,items:[{xtype:'datefield',name:"date",allowBlank : false,fieldLabel:"成",width:180}]},{layout:"form",columnWidth:.1,items:[{xtype:"label",text:"*",style:"color:red"}]}]
	           }, {
	        	   layout:"form",columnWidth:.4,items:[{xtype:"textfield",fieldLabel:"成",width:100}]
	           }]},{layout:"form",items:[{xtype:'textfield',fieldLabel:"成",width:200},{xtype:'textfield',fieldLabel:"成",width:300}]}
	           ,{layout: "column",items:[{layout:"form",columnWidth:.5,items:[combos1]},{layout:"form",columnWidth:.5,items:[combos2]}]}
	          /* , {layout:'table',layoutConfig : {columns : '2'},items:[{layout:'form',items:[combos1]},{layout:'form',items:[combos2]}]}*/
	           ,{layout:"form",items:[{
	        	   width:200,
	               xtype: 'fileuploadfield',
	               id: 'form-file1',
	               emptyText: 'Select an image',
	               fieldLabel: 'Photo1',
	               name: 'photopath1',
	               buttonText: '',
	               buttonCfg: {
	                   iconCls: 'silk_add'
	               }
	           }]},{layout:"form",items:[{
	        	   width:200,
	               xtype: 'fileuploadfield',
	               id: 'form-file2',
	               emptyText: 'Select an image',
	               fieldLabel: 'Photo2',
	               name: 'photopath2',
	               buttonText: '',
	               buttonCfg: {
	                   iconCls: 'silk_add'
	               }
	           }]}
	           ]
	        	      
		    });
		  
		 
		
		  
		  
	      return new  Ext.form.FormPanel({
	    	    id:"formadd",
	      	    region:'center',
	      	    fileUpload: true,
	      	    enctype:'multipart/form-data',
	      	    method:'POST', 
	      	    width:550,
		        height:350,
		        border:true,
		        labelAlign:'right',
		        frame:true,
		        items:[addset]
		    });	  
	      
	      
	   
		
	}
	
	
});